<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>jQuery下拉菜单</title>
    <style>
        .nav {
            background-color: #333;
            color: #fff;
            height: 40px;
            line-height: 40px;
            padding: 0 20px;
        }
        
        .nav-main li {
            display: inline-block;
            margin-right: 10px;
            position: relative;
        }
        
        .nav-main li span {
            display: inline-block;
            width: 6px;
            height: 6px;
            background-color: #fff;
            border-radius: 50%;
            position: absolute;
            top: 17px;
            right: -8px;
            opacity: 0;
        }
        
        .hidden-box {
            display: none;
            position: absolute;
            top: 10%; /* 修改这里 */
            left: 10%;
            background-color: #333;
            color: #fff;
            padding: 10px;
        }
        
        .hidden-box ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        
        .hidden-box ul li {
            margin-bottom: 10px;
        }
    </style>
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <script>
        $(document).ready(function () {
            // 鼠标经过显示下拉菜单
            $('.nav-main li').hover(
                function () {
                    var boxId = $(this).attr('id');
                    $('#' + boxId.replace('1i', 'box')).show();
                },
                function () {
                    var boxId = $(this).attr('id');
                    $('#' + boxId.replace('1i', 'box')).hide();
                }
            );
        });
    </script>
</head>

<body>
    <div class="nav">
        <ul class="nav-main">
            <li>首页</li>
            <li id="1i-1">关于<span></span></li>
            <li id="1i-2">信息<span></span></li>
            <li id="1i-3">消费者服务<span></span></li>
            <li id="1i-4">商务服务<span></span></li>
            <li>研究中心</li>
        </ul>
        <div id="box-1" class="hidden-box hidden-loc-index">
            <ul>
                <li>目的意义</li>
                <li>发展历程</li>
                <li>组织架构</li>
                <li>精英团队</li>
            </ul>
        </div>
        <div id="box-2" class="hidden-box hidden-loc-us">
            <ul>
                <li>加入联盟步骤</li>
                <li>申请要求</li>
            </ul>
        </div>
        <div id="box-3" class="hidden-box hidden-loc-info">
            <ul>
                <li>消费者服务</li>
                <li>产品信息</li>
                <li>关于我们</li>
                <li>商家信息</li>
                <li>加入我们</li>
            </ul>
        </div>
        <div id="box-4" class="hidden-box hidden-loc-info box04">
            <ul>
                <li>服务理念</li>
                <li>服务产品</li>
                <li>周边有机网络</li>
                <li>商铺汇总</li>
                <li>有机百科</li>
                <li>保障与维权</li>
            </ul>
        </div>
    </div>
</body>

</html>
